package com.radio.view;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;

public class RadioProgram extends Activity{

	private static EventRadio mER;
	
	private TextView mTVTime;
	private TextView mTVFrequency;
	private ListView mLV;
	
	private ImageButton mIBplay;
	private ImageButton mIBstop;
	private ImageButton mIBpause;
	
	static final String[] mFrequency = new String[] {	// read from file 
	    "89.1", "99.2", "70.3", "103.5", "110.1", 
	    "33.3", "105.2", "77.9", "20.4", "33.1", 
	    "22.7", "47.7", "44.7", "37.4", "56.7"
	    };
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		mER = new EventRadio(this, RadioProgram.this);
		
		mTVTime = (TextView) findViewById(R.id.idnumtime);
		mTVFrequency = (TextView) findViewById(R.id.idnumfrequency);
		mIBplay = (ImageButton) findViewById(R.id.idplaybutton);
		mIBpause = (ImageButton) findViewById(R.id.idpausebutton);
		mIBstop = (ImageButton) findViewById(R.id.idstopbutton);

		mLV = (ListView) findViewById(R.id.idlist);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list, mFrequency);
		mLV.setAdapter(adapter);
		mLV.setOnItemClickListener(mER);
		mLV.setOnItemSelectedListener(mER);
		registerForContextMenu(mLV);		

		mIBplay.setOnClickListener(mER);
		mIBpause.setOnClickListener(mER);
		mIBstop.setOnClickListener(mER);
		
	}
	
	public String[] getMfrequency() {
		return mFrequency;
	}

	public TextView getmTVFrequency() {
		return mTVFrequency;
	}

	public TextView getmTVTime() {
		return mTVTime;
	}

	public ListView getmLV() {
		return mLV;
	}

	public ImageButton getmIBplay() {
		return mIBplay;
	}

	public ImageButton getmIBstop() {
		return mIBstop;
	}

	public ImageButton getmIBpause() {
		return mIBpause;
	}
}